package com.sq.partner.manager.dao.impl;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sq.partner.manager.dao.TradProdPropDao;
import com.sq.partner.manager.mybatis.model.TradProdProp;

@Repository
public class TradProdPropDaoImpl extends BaseDaoImpl implements TradProdPropDao {

	@Override
	public  List<Map<String, Object>> impNlifeProp(Map<String, Object> map)
			throws SQLException {
		return this.queryList("impNlifePropByMap", map);
	}

	@Override
	public List<Map<String, Object>> impNocarProp(Map<String, Object> map)
			throws SQLException {
		 return this.queryList("impNocarPropByMap", map);
	}

	@Override
	public boolean addProdProp(TradProdProp tradProdProp) throws Exception {
		return this.add("insertProdProp", tradProdProp);
	}
	@Override
	public Integer updateProdProp(TradProdProp tradProdProp) throws Exception {
		return this.getSession().update("updateTradProdProp",tradProdProp);
	}

	@Override
	public boolean deleteProdProp(String prodCode) throws Exception {
		return this.delete("deleteTradProdProp", prodCode);
	}
	
	//激活卡激活
	/**
     * 根据产品号查询产品订制属性
     * @param tradProdCode
     * @return
     * @throws Exception
     */
	@SuppressWarnings("unchecked")
    @Override
    public List<TradProdProp> queryTradProdProp(String tradProdCode)
            throws Exception {
	    Map<String,String> map = new HashMap<String,String>();
        map.put("tradProdCode", tradProdCode);
        return (List<TradProdProp>) queryList("queryTradProdPropByMap", map);
	}
}
